package jeudevie.models;

/**
 * Une position dans le plan bidimensionnel
 */
public class Position {
    private int x, y;

    public Position(int x, int y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || !(obj instanceof Position)) {
            return false;
        }

        return this.x == ((Position) obj).x;
    }

    @Override
    public int hashCode() {
        return 127 * this.x + 7 * this.y;
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }
    
    public String toString() {
    	return "(" + this.getX() + ", " + this.getY() + ")";
    }
}
